//
//  WWYSearchTableViewCell.m
//  Pianke
//
//  Created by Daydream on 16/1/4.
//  Copyright © 2016年 dada. All rights reserved.
//

#import "WWYSearchTableViewCell.h"
#import "WWYSearchModel.h"

@interface WWYSearchTableViewCell ()

@property (nonatomic, strong) UIImageView *imageV;

@property (nonatomic, strong) UILabel *lable;

@end

@implementation WWYSearchTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self makeCell];
    }
    return self;
}

- (void)makeCell{
    self.imageV = [[UIImageView alloc] init];//WithFrame:CGRectMake(0, 0, 50, 50)];
    [self.contentView addSubview:self.imageV];
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(@0);
        make.left.mas_equalTo(@10);
        make.size.mas_equalTo(CGSizeMake(20, 20));
    }];
    
    self.lable = [[UILabel alloc] init];//WithFrame:CGRectMake(100, 0, 100, 50)];
    [self.contentView addSubview:self.lable];
    [self.lable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(@50);
        make.top.bottom.right.mas_equalTo(@0);
    }];
}

- (void)setModel:(WWYSearchModel *)model{
    if (_model != model) {
        _model = model;
    }
   NSInteger type = self.model.type;

    if (type == 17) {
        //音频
        self.imageV.image = [UIImage imageNamed:@"iconfont-bofangSmall"];
    }else if (type == 1){
        //文章
        self.imageV.image = [UIImage imageNamed:@"iconfont-menu-3"];
        
    }else{
        //论坛
        self.imageV.image = [UIImage imageNamed:@"iconfont-taolun"];
    }
    
    self.lable.text = self.model.title;

}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
